<script setup>
// import { ref } from 'vue'
import { useFetch } from '../../utils/fetch'
const { data, error } = useFetch('https://api.github.com/users/ruanyf')

// const data = ref(null)
// const error = ref(null)

// fetch('https://api.github.com/users/ruanyf')
//   .then((res) => res.json())
//   .then((json) => (data.value = json))
//   .catch((err) => (error.value = err))
</script>

<template>
  <div v-if="error">Oops! Error encountered: {{ error.message }}</div>
  <div v-else-if="data">
    Data loaded:
    <pre>{{ data }}</pre>
  </div>
  <div v-else>Loading......</div>
</template>
